//***************************************************************
//  File:    GameObject.h
//  Date:    12/17/2012
//  Author:  liangxc (liangxc2010@gmail.com)
//-------------------------------------------------------------
//
//-------------------------------------------------------------
//  This file is part of Hare2D Game Engine.
//  Copyright (C) All Rights Reserved
//***************************************************************
//
//***************************************************************
#ifndef __SPRITECOMPONENT_H__
#define __SPRITECOMPONENT_H__

#include "GraphicsPrerequisites.h"
#include "Material.h"
#include "Component.h"

namespace hare
{
	class GRAPHICS_API SpriteComponent : public Component
	{
		HARE_DECLARE_DYNAMIC_CLASS(SpriteComponent)
	public:
		SpriteComponent();
		virtual ~SpriteComponent();

		virtual void update(){};
		virtual void render(PointF pos, PointF rotation, PointF scale);

		void setZ(float z);
		float getZ();

		void setOffset(float x, float y);
		void setOffset(const PointF& off);
		PointF getOffset();

		void setHFlip(bool flag);
		bool getHFlip();

		void setVFlip(bool flag);
		bool getVFlip();

		void setColor(uint32 c);
		uint32 getColor();

		void setUV(float l, float r, float t, float b);
		void setUV(const RectF& rect);
		RectF getUV();

		void setMaterial(TextureMtrl::Ptr m);
		TextureMtrl::Ptr getMaterial();

	protected:
		float  zDepth;
		PointF offset;
		bool   hFlip;
		bool   vFlip;
		uint32 color;
		RectF rectUV;
		TextureMtrl::Ptr mtrl;
	};
}

#endif